class GameMap extends AcGameObject{
    constructor (playground) {
        super();
        this.playground = playground;
        this.$canvas = $(`<canvas tabindex=0></canvas>`);  // 给本来不能监听事件的标签可以监听
        this.ctx = this.$canvas[0].getContext('2d');
        this.ctx.canvas.width = this.playground.width;
        this.ctx.canvas.height = this.playground.height;
        this.playground.$playground.append(this.$canvas);

        this.start()
    }

    start(){
        this.$canvas.focus();  // 聚焦
    }
    
    resize(){
        this.ctx.canvas.width = this.playground.width;
        this.ctx.canvas.height = this.playground.height;
        this.ctx.fillStyle = "rgb(0,0,0)";
        this.ctx.fillRect(0, 0 , this.ctx.canvas.width, this.ctx.canvas.height);

    }

    update(){
        this.render();
    }
    render(){ //渲染
        this.ctx.fillStyle = "rgb(0,0,0,0.2)";
        this.ctx.fillRect(0, 0 , this.ctx.canvas.width, this.ctx.canvas.height);
    }
}
